コード例 #1
0
def register_view():
    if request.method == 'GET':
        return render_template('gentelella/users/login/register.html')
    if request.method == 'POST':
        logging.info("Registration under process")
        s = get_serializer()
        data = [request.form['email'], request.form['password']]
        user = DataManager.create_user(data)
        form_hash = s.dumps([request.form['email'], str_generator()])
        link = url_for('.create_account_after_confirmation_view', hash=form_hash, _external=True)
        send_email_confirmation(request.form, link)
        login.login_user(user)
        record_user_login_logout('user_login', user)
        logging.info('logged successfully')
        user_logged_in(user)
        return redirect(intended_url())
コード例 #2
0
    def get_or_create_user_by_email(email, data=None):
        user = DataGetter.get_user_by_email(email, True)
        if not user:
            password = binascii.b2a_hex(os.urandom(4))
            user_data = [email, password]
            user = DataManager.create_user(user_data)
            send_email_after_account_create_with_password({
                'email': email,
                'password': password
            })

        if not user.user_detail:
            user_detail = UserDetail(firstname=data['firstname'], lastname=data['lastname'])
            user.user_detail = user_detail

        save_to_db(user)
        return user
コード例 #3
0
def register_view():
    if request.method == 'GET':
        return render_template('gentelella/admin/login/register.html')
    if request.method == 'POST':
        logging.info("Registration under process")
        s = get_serializer()
        data = [request.form['email'], request.form['password']]
        user = DataManager.create_user(data)
        form_hash = s.dumps([request.form['email'], str_generator()])
        link = url_for('.create_account_after_confirmation_view',
                       hash=form_hash,
                       _external=True)
        send_email_confirmation(request.form, link)
        login.login_user(user)
        record_user_login_logout('user_login', user)
        logging.info('logged successfully')
        user_logged_in(user)
        return redirect(intended_url())
コード例 #4
0
 def create(self, data):
     data = self.validate(data)
     user = DataManager.create_user([data['email'], data['password']])
     return user
コード例 #5
0
 def create(self, data):
     data = self.validate(data)
     user = DataManager.create_user([data['email'], data['password']])
     return user
コード例 #6
0
def create_user(email, password, is_verified=True):
    """
    Registers the user but not logs in
    """
    DataManager.create_user([email, password], is_verified=is_verified)
コード例 #7
0
def create_super_admin(email, password):
    user = DataManager.create_user([email, password], is_verified=True)
    user.is_super_admin = True
    user.is_admin = True
    save_to_db(user, "User updated")
    return user
コード例 #8
0
 def create(self, data):
     data = self.validate(data)
     user = DataManager.create_user([data["email"], data["password"]])
     return user