You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/controllers/user_tokens_controller.rb

22 lines
519 B
Ruby

class UserTokensController < ApplicationController
before_filter :ensure_authenticated!
def create
ut = current_user.add_user_token(params[:user_token])
if ut.valid?
claimed_num = Asciicast.assign_user(ut.token, current_user)
if claimed_num > 0
notice = "Claimed #{claimed_num} asciicasts, yay!"
else
notice = "Authenticated successfully, yippie!"
end
redirect_to profile_path(current_user), :notice => notice
else
render :error
end
end
end