Settings Bundle and SwiftUI - swiftui

During objective C days, we would store the username and password in the settings bundle, so that if the user wanted to change either item, they could do so via the settings of the app in question.
While the username is unlikely to change (given that the iPhone is a personal device), there may be rare cases where this may occur in my app, and the password may be changed from the desktop version, where the user will have to update it here.
Is the settings bundle still the preferred way to handle this scenario in SwiftUI or is there a SwiftUI based alternative?
How do we handle the Settings Bundle with SwiftUI? Could someone post a code sample or a link to an appropriate article?
Thanks in advance.

Storing sensitive data in Settings is not a good idea. Here is a good summary of your options: Secret Management on iOS.
To access Settings (NSUserDefaults) from Swift see How to save user settings using UserDefaults

Related

How to handle project or app specific settings in django?

How can one store, retrieve and allow the user to change the settings of a project or an app? A constant in settings.py is not good enough, as I want some users to be able to change the value of the setting. A way to present these in the admin interface would be optimal.
If it's via an admin interface then using the database sounds like a sure bet. Check out this similar looking question on StackOverflow.

Is there any available Django already built package for login

Django has its well designed admin site which is normally located at your-site/admin.
The interface is very powerful. However, you have to set permissions if you have multiple users with different rights and you have to modify a lot if the user asks you for very customised features.
So now my questions are:
should I build my own login site to provide website-specific features?
is there any already built package which I can re-use and add my own features into it?
When I need to use (and probably customize) a login application I always use django-registration.
It is a very complete app, I has email activation key and some other interesting features. And if you want to add/modify some new functionality you just have to create a new backend (you can inherit the common behaviour from the default backend.
https://bitbucket.org/ubernostrum/django-registration
https://github.com/nathanborror/django-registration
Hope it helps
You can create User Groups in django-admin to simplify assigning permissions instead of setting permissions to individual users.
Django-admin has a number of limitations, but there is a lot of extensions to manage them.
The app django-userna will take your pain away.
http://django-userena.org/
But personnaly i use Pinax. When i start a project all account (login/password reset/email management etc ...) is built in and i can focus on what makes my project different instead of reinventing all the user management stuff.

what's the best django profile / user settings application around?

I'm looking for a good django app that brings to me basic features like
user profile editing
password changing
save settings / preferences specific to my app
save authentication keys to external apps (twitter, rtm, facebook, ...)
I know how to extend the normal user model (see docs http://www.djangobook.com/en/1.0/chapter12/#cn222)
and there are also these apps around:
django-profile/
idios (on github)
django-account/
however, none of them seems to be ideal for what I want.
Therefore, my question is, does anyone know a app that is better / more mature / more feature rich that I just didn't find?
Or do I have to roll my own app?
I use django-userena.
https://github.com/bread-and-pepper/django-userena
demo: http://www.django-userena.org
I am sorry to inform you that you will (for now) have to put together a custom solution using django-registration/django-profiles along with django-socialregistration.
Start here with and progress to Socialnetwork Authentication. On the up side, django is young so solid solutions are in the near future and you will be part of them. ;-)

Django settings app?

Has anyone run into an idea of a "settings app" for a django project?
It's a set of application variables set by an administrator (not developer, so settings.py fails) using admin panel.
Are there any apps ready to use?
edit
I probably didn't state my question clear. I don't mean editing the things like connection settings, rather things like "file size limit".
There is a very nice app that does this, called django-dbsettings. The official repo hasn't been updated in years, but I have an up-to-date fork on my github page.
The question is how would you store the settings.
Cause... if you store the settings in the database it will be troublesome since most of the code will already be initialized (using the settings before that) before you have a database connection.
If it's the filesystem that means you're going to have to include a Python file that's being modified by your webserver which sounds like a huge security risk to me.
So... in my opinion, it could be done but I would vote against it since it's dangerous. If things should be configurable from the web, implement that in the app :)
It sounds a bit like you're asking "how does an administrator change the settings (like database connection parameters) without changing settings.py?"
If your admin isn't familiar enough with python to change the settings.py file directly, you might consider giving the admin a simpler file to edit, perhaps a config file that you loaded from settings.py. Then all your admin has to do is edit the config file and restart the server.
This has an added benefit that you can limit the config file to only those parameters which your admin would need to mess with (like database connection parameters).
(Another option would be to get a better admin ...)

Django Admin: Allow email as a username?

I've recently inherited a django project and I'm facing a serious amount of bugs/issues and ...quirks that need to be fixed. As I'm coming from a php background (don't ask), I'm having a ...challenging time.
In terms of the Django admin, It will not accept any email address as a username. However, IN our front-end - the previous developer designed the system in such a way that the application used an email address as the username. This is fine in the frontend, but we can't save any changes we make to a user in the admin section ¬.¬
Is there any way to fix this WITHOUT updating our django installation to v1.2 (NOT an option) and WITHOUT modifiying any of the Django.contrib files?
I've heard good things about extending these classes/method, but I'm very unsure how to proceed.
Looking at websites online, they suggest writing a custom backend, etc...? Is the the right way to go about it? I'm not too confident a djanog programmer though, and considering this is to do with User Logins, I'd be VERY unconfident about any solution I could write.
Is there an easy way I can simply override the username validation method to accept an # and be over 30 chars?
This snippet might be helpful:
Use email addresses for user name
If you use django1.2.1 there is no problem: http://docs.djangoproject.com/en/1.2/topics/auth/#fields