You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, first time user of Flask-user.
While logged in, I don't expect to have access to the registration view. I but I do. I don't believe it is supposed to work this way.
Just like the log in view is not accessible while logged in, access to the register view must be denied.
So I looked at the code in the login_view function and the following snippet is what prevents access:
Immediately redirect already logged in users
if self.call_or_get(current_user.is_authenticated) and self.USER_AUTO_LOGIN_AT_LOGIN:
return redirect(safe_next_url)
But I dont see this under the register_view.
Or am I missing something?
thanks!
The text was updated successfully, but these errors were encountered:
You can in this particular case customize the view, if that's important for you.
Below is an example of using customize and a custom function. It's been a while since I touched flask_user so use this as a reference and don't copy-pasta-it. The code is mostly copied from the source code. Reading it will most likely yield you a similar result.
fromflask_user.user_managerimportUserManagerfromflaskimportredirectclassCustomUserManager(UserManager):
defcustom_register_view(self):
"""Prepare and process the login form."""safe_next_url=self._get_safe_next_url('next', self.USER_AFTER_LOGIN_ENDPOINT)
# Immediately redirect already logged in usersifself.call_or_get(current_user.is_authenticated) andself.USER_AUTO_LOGIN_AT_LOGIN:
returnredirect(safe_next_url)
# run normal register view viewself.register_view_old()
defcustomize(self, app):
self.register_view_old=self.register_viewself.register_view=self.custom_register_viewuser_manager=CustomUserManager(app, db, User)
The Project is on hiatus (not maintained) since about the start of 2020. I would recommend you to either implement the required parts in flask_login or search for another solution.
Hello, first time user of Flask-user.
While logged in, I don't expect to have access to the registration view. I but I do. I don't believe it is supposed to work this way.
Just like the log in view is not accessible while logged in, access to the register view must be denied.
So I looked at the code in the login_view function and the following snippet is what prevents access:
Immediately redirect already logged in users
if self.call_or_get(current_user.is_authenticated) and self.USER_AUTO_LOGIN_AT_LOGIN:
return redirect(safe_next_url)
But I dont see this under the register_view.
Or am I missing something?
thanks!
The text was updated successfully, but these errors were encountered: