post '/sign_in'
   Creates a new Session record then sends the magic link
   renders sessions/create.html.erb.
 @see Mailer#magic_link Mailer#magic_link
332372
def create
      session = build_passwordless_session(find_authenticatable)

      if session.save
        Passwordless.after_session_save.call(session)
      end

      render
    end
1031151
def create
			@message = Message.new(message_params)

			if @message.valid?
				MessageMailer.message_me(@message).deliver_now
				redirect_to new_message_path, notice: "Thank you for your message."
			else
				render :new
			end
		end
1204505
def create
      user = User.new(user_params)

      if user.save
        UserMailer.confirm_account(user).deliver_now
        render json: user, status: :created
      else
        render json: user.errors, status: 422
      end
    end
256138
def create
      @family = Family.new
      [:father, :mother].each do |p|
        pp = params[p].keep_if { |k,v| !v.blank? }

        @family.__send__ "#{p}=", (pp.blank? ? nil : get_user_from_params(pp))
      end

      respond_to do |format|
        if @family.save
          uninitialized_pw = User.initialize_without_password("").password_digest
          [@family.father, @family.mother].select { |p| p }.each { |p|
            user_is_new = p.user.password_digest == uninitialized_pw
            EasyRailsAuthentication::AuthenticationHelper.SendPasswordInitializationEmailTo p.email if user_is_new
          }
          format.html { redirect_to (added_user_info? ? family_url(@family.id) : families_url), notice: 'Family was successfully created.' }
          format.json { render json: @family, status: :created, location: @family }
        else
          format.html { render action: "new" }
          format.json { render json: @family.errors, status: :unprocessable_entity }
        end
      end
    end
631032
def create
      @object = resource.new(object_params)
      authorize_for(action: :create,
                    resource: resource.name.underscore.to_sym,
                    object: @object)
      if @object.save
        render json: @object.to_json, status: :created
      else
        render json: @object.errors, status: :unprocessable_entity
      end
    end
1297092
def create
      params.require(:user).permit!
      user = User.new(params[:user])
      if user.valid?
        user.save
        flash.now[:success] = t('landing_page.subscribed')
        render :create
      else
        @user = user
        render :new
      end
    end
416330
def create_ticket
      post_param = { username: @username, realm: @realm, password: @password }
      @site['access/ticket'].post post_param do |response, _request, _result, &_block|
        if response.code == 200
          extract_ticket response
        else
          @connection_status = 'error'
        end
      end
    end
379088
def create
      failures = []
      invites = InviteForm.new(invite_params).build_invites(current_user)
      ActiveRecord::Base.transaction do
        invites.each { |invite| invite.save ? do_invite(invite) : failures << invite.email }
      end

      respond_to do |format|
        format.html do
          if failures.empty?
            flash[:notice] = t('invitation.flash.invite_issued', count: invites.count)
          else
            flash[:error] = t('invitation.flash.invite_error', count: failures.count, email: failures.to_sentence)
          end
          redirect_to url_after_invite(invites.first) # FIXME: redirect to back
        end
        format.json do
          if failures.empty?
            # If we received a single email, json response should be a scalar, not an array.
            invites = params[:invite].key?('email') ? invites.first : invites
            render json: invites.as_json(except: [:token, :created_at, :updated_at]), status: 201
          else
            render json: {
              message: t('invitation.flash.invite_error', count: failures.count, email: failures.to_sentence),
              status: :unprocessable_entity
            }
          end
        end
      end
    end
726637
public function newAction()
    {
        $model = $this->loadModel();
        if (!$model->isObjectNew()) {
            $this->_forward('noroute');
            return;
        }

        if ($this->getRequest()->isPost()) {
            $postData = $this->getRequest()->getPost();
            try {
                $model->isObjectNew(true);
                foreach ($this->preprocessPostData($postData) as $key => $value) {
                    $model->setDataUsingMethod($key, $value);
                }
                $model->save();
                $this->_redirectUrl($this->getHelper()->getGridUrl());
                $this->_getSession()->addSuccess('Saved Successfully');
                return;
            } catch (Exception $e) {
                $message = $e->getMessage();
                if ($e instanceof Zend_Db_Statement_Exception && $e->getChainedException() instanceof PDOException) {
                    /** @var PDOException $e */
                    $e = $e->getChainedException();
                    if (isset($e->errorInfo[0]) && $e->errorInfo[0] == 23000 && isset($e->errorInfo[1]) && $e->errorInfo[1] == 1062) {
                        $message = $this->getHelper()->__(
                            "Record already exists for %s '%s'",
                            $model->getIdFieldName(),
                            $model->getId()
                        );
                    }
                }
                Mage::logException($e);
                $this->_getSession()->addError($message);
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
224820
def load_current_users
      return if !@connect_current_user.nil?

      if @request.ssl? && @cookies.signed[:secure_user_id] != "secure#{@session[:user_id]}"
        sign_out! # hijacked
      else
        # If there is a session user_id, load up that user, otherwise set the anonymous user.
       
        if @session[:user_id]
          @connect_current_user = User.where(id: @session[:user_id]).first

          # It could happen (normally in development) that there is a session user_id that 
          # doesn't map to a User in the db.  In such a case, sign_out! to reset the state
          if @connect_current_user.nil?
            sign_out!
            return
          end
        else
          @connect_current_user = User.anonymous
        end

        # bring the app user inline with the connect user
        @app_current_user = user_provider.connect_user_to_app_user(@connect_current_user)
      end
    end
582746
def create
      authorize! :create, Arm
      @arm = Arm.new(arm_params)
      if @arm.save
        redirect_to @arm,
                    notice: "Arm was successfully created."
      else
        render :new
      end
    end
266306
def create
      @share_link = @file.share_links.build(permitted_params.share_link)
      @share_link.user = boxroom_current_user

      if @share_link.save
        UserMailer.share_link_email(@share_link).deliver_now
        redirect_to @folder, :notice => t(:shared_successfully)
      else
        render :action => 'new'
      end
    end
877786
def create_contribution

      @initiative = Initiative.find(contribution_params[:initiative_id])
      @gateways = @initiative.gateways.without_state(:draft).ordered
      @contribution = @initiative.contributions.new(contribution_params)
      @contribution.gateway_state = @contribution.gateway.state
      current_user.update module_name: @contribution.gateway.module_name
      authorize @contribution

      if @contribution.save
        true
      else
        render '/initiatives/contributions/new'
        false
      end

    end
829376
def POST(self):
        
        if self.user_manager.session_logged_in() or not self.app.allow_registration:
            raise web.notfound()

        reset = None
        msg = ""
        error = False
        data = web.input()
        if "register" in data:
            msg, error = self.register_user(data)
        elif "lostpasswd" in data:
            msg, error = self.lost_passwd(data)
        elif "resetpasswd" in data:
            msg, error, reset = self.get_reset_data(data)
            if reset:
                msg, error = self.reset_passwd(data)
            if not error:
                reset = None

        return self.template_helper.get_renderer().register(reset, msg, error)
1175677
def magic_session(db_session=None, url=None):
    

    if db_session is not None:
        yield db_session
    else:
        session = get_session(url, expire_on_commit=False)
        try:
            try:
                yield session
            finally:
                session.commit()
        finally:
            session.close()
1339027
def sign_up_with(email, password)
      Capybara.exact = true
      visit new_user_registration_path
      fill_in 'Email', with: email
      fill_in 'Password', with: password
      fill_in 'Password confirmation', with: password
      click_button 'Sign up'
    end
1116228
protected function magicInit()
    {
        if (!$this->magicInited) {
            $this->magicFields = array_replace($this->magicFields, $this->magicGetDefaults());
            $this->magicInited = true;
        }
    }