3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/forest_liana/devise_controller.rb', line 3
def change_password
resource = SchemaUtils.find_model_from_collection_name(
params['data']['attributes']['collection_name'])
user = resource.find(params['data']['attributes']['ids'].first)
user.password = params['data']['attributes']['values']['New password']
user.save
if user.valid?
head :no_content
else
render status: 400, json: {
error: user.errors.try(:messages).try(:[], :password)
}
end
end
|