def restore_password(self, data, req_info, curs=None): env_name = data.get('environment_name') env_f = EnvironmentFilter({'name': env_name}, {}, None) env = env_f.filter_one_obj(curs) # For correct action logging data['environment_id'] = env.id user_f = SubjectUserFilter(env.id, {'email': data.get('email')}, {}, None) user = user_f.filter_one_obj(curs) # creating user session auth = Authenticator() session = auth.create_restore_password_session(curs, env, user, req_info, lifetime_minutes=settings.session_restore_password_lifetime_minutes) _add_log_info(data, session) n = Notifier() n_process = n.restore_password(curs, user, session) return response_ok(notification=n_process)
def get_subj_user(self, environment_id, email, curs=None): filter_params = {'environment_id': environment_id, 'email': email} f = SubjectUserFilter(environment_id, filter_params, {}, {}) return f.filter_one_obj(curs)